package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class DrawRecordAdapter extends StkProviderMultiAdapter<String> {

    public DrawRecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(250));
        addItemProvider(new DrawRecordProvider());
    }

    private class DrawRecordProvider extends BaseItemProvider<String> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_draw_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, String path) {
            Glide.with(getContext()).load(path)
                    .into((ImageView) baseViewHolder.getView(R.id.ivDrawRecordItemImg));
        }
    }
}
